<template>
    <div class="ding">
        <el-dialog title="订单记录" :visible.sync="form3.dialogFormVisible">
        <el-form :model="form3" :rules="rules" ref="form3">
            <el-form-item label="选择类型" :label-width="formLabelWidth">
                <el-radio-group v-model="form3.radio">
                <el-radio label="1">发货</el-radio>
                <el-radio label="2">送货</el-radio>
                <el-radio label="3">虚拟</el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item label="快递公司" prop="company" :label-width="formLabelWidth">
            <el-select v-model="form3.company" placeholder="请选择">
                <el-option  v-for="(v,i) in arr" :key="i" :label="v.value" :value="v.value"></el-option>
            </el-select>
            </el-form-item>

            <el-form-item label="快递单号" prop="dan" :label-width="formLabelWidth">
            <el-input v-model="form3.dan" autocomplete="off" placeholder="请输入快递单号"></el-input>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="form3.dialogFormVisible = false">取 消</el-button>
            <el-button type="primary" @click="submitForm('form3')">提 交</el-button>
        </div>
        </el-dialog>
    </div>
</template>

<script>
import {orderfas} from '../../api/index'
export default {
    props:['form3','arr'],
    data(){
        return {
            formLabelWidth: '80px',
            rules: {
                company: [
                    { required: true, message: '请选择快递', trigger: 'blur' },
                ],
                dan: [
                    { required: true, message: '请填写快递单号', trigger: 'blur' },
                ]
            },
        }
    },
    methods:{
        submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            console.log(this.form3);
            orderfas({id:this.form3.ids,type:this.form3.radio,danhao:this.form3.dan,name:this.form3.company}).then(res => {
                console.log(res.data);
                if (res.data.status === 200) {
                    this.form3.dialogFormVisible = false
                    this.$emit('dingVal',this.form3.dialogFormVisible)
                }else{
                    this.$message.error('更新错误')
                }
            },err => {
                console.log(err);
            })
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
    }
}
</script>

<style lang="scss">
    
</style>